package socket;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressTest {
	
	public static void main(String[] args) throws UnknownHostException {
		//获取本机InetAddress 实例
		InetAddress address = InetAddress.getLocalHost();
		//计算机名
		System.out.println(address.getHostName());
		//输出IP地址
		System.out.println(address.getHostAddress());
		
		System.out.println(address);
	}

}
